import React, { useEffect } from 'react';

export default function Proto() {
    useEffect(() => {
        let json = {
            a: 1,
            b: [1, 23, 4],
            c: {
                a: 1,
                b: 2
            }
        };

        function copy(object) {
            let obj = object instanceof Array ? [] : {};
            for (const [k, v] of Object.entries(object)) {
                obj[k] = typeof v === 'object' ? copy(v) : v;
            }
            return obj;
        }

        let cps = copy(json);
        cps.b[0] = '123dsrfs';
        console.log(cps);
        console.log(json);

    });
    return (
        <div>
            deep clone
        </div>
    );
}